<?php

/**
 * 后台首页
 */
namespace Admin\Controller;
use Common\Controller\AdminbaseController;
class IndexController extends AdminbaseController {
	
	
	function _initialize() {
		parent::_initialize();
	}
    //后台框架首页
    public function index() {



    	$mysql= mysql_get_server_info();
    	$mysql=empty($mysql)?"未知":$mysql;
    	//服务器信息
    	$info = array(
    			'操作系统' => PHP_OS,
    			'运行环境' => $_SERVER["SERVER_SOFTWARE"],
    			'PHP运行方式' => php_sapi_name(),
    			'MYSQL版本' =>$mysql,
    			'程序版本' => LAPCMS_VERSION ,
    			'上传附件限制' => ini_get('upload_max_filesize'),
    			'执行时间限制' => ini_get('max_execution_time') . "秒",
    			'剩余空间' => round((@disk_free_space(".") / (1024 * 1024)), 2) . 'M',
    	);
    	$this->assign('server_info', $info);


    	
    
    	
    
       	$this->display("");
        
    }
    //清除缓存
    public function clearcache(){
    		
    
		import ( "ORG.Util.Dir" );
		$dirs = array ();
		// runtime/
		$rootdirs = scandir ( RUNTIME_PATH );
		//$noneed_clear=array(".","..","Data");
		$noneed_clear=array(".","..");
		$rootdirs=array_diff($rootdirs, $noneed_clear);
		foreach ( $rootdirs as $dir ) {
			
			if ($dir != "." && $dir != "..") {
				$dir = RUNTIME_PATH . $dir;
				if (is_dir ( $dir )) {
					array_push ( $dirs, $dir );
					$tmprootdirs = scandir ( $dir );
					foreach ( $tmprootdirs as $tdir ) {
						if ($tdir != "." && $tdir != "..") {
							$tdir = $dir . '/' . $tdir;
							if (is_dir ( $tdir )) {
								array_push ( $dirs, $tdir );
							}
						}
					}
				}else{
					@unlink($dir);
				}
			}
		}
		$dirtool=new \Dir("");
		foreach ( $dirs as $dir ) {
			$dirtool->del ( $dir );
		}
		
		
		D("Config")->data_cache();
		D("Model")->data_cache();
		D("AuthRule")->data_cache();
		D("Cate")->category_cache();
		D("Cate")->data_cache();
		D("Var")->data_cache();
		//D("Link")->data_cache();
		D("Slide")->data_cache();
		D("Frag")->data_cache();
		D("Ad")->data_cache();
		D("Route")->data_cache();
		D("Group")->data_cache();

		D("Xiaoqu")->data_cache();
		D("Shop")->data_cache();


		
    	$this->success("缓存更新成功！");
    }



	public function  wx_info(){


		$open_id=I("get.open_id");


		$u_inf=$this->wk->userInfo($open_id);

		$this->assign("_data",$u_inf);
		$this->display("");




	}

	public  function  sendTplMsg(){





	}


}

?>
